import Levels from './rule-level'
import Types from './rule-type'
import Utils from './_utils'

const rule = 'custom'

/*
* config {
*   custom: // Function
* }
* */

export default {
  priority: Levels.LOW_LEVEL, // validate input chars first
  validate: function (value, config, model, formModel, filed, fieldScope) {
    return {
      valid: Utils.validateWrapper(config.custom, null, value, config, model, formModel, (params, value, model, formModel) => {
        return params
      }),
      errorTemplate: undefined,
      errorParams: undefined
    }
  },
  rule: rule,
  type: Types.ATTRIBUTE
}
